<script type="text/javascript" src="/Public/js/jquery.form.min.js"></script>
  <div class="form">
    <form method='post' id="form_do" name="form_do" action="{:U(MODULE_NAME.'/Product/sellrecommendadd')}">
        <dl>
          <dt>推荐产品ID：</dt>
          <dd>
            <input type="text" name="productID" class="inp_default" onkeyup="productData(this)">
          </dd>
        </dl>
        <dl>
          <dt>推荐产品名称：</dt>
          <dd>
            <input type="text" name="productTitle" class="inp_default" id="productTitle" >
          </dd>
        </dl>
        <dl>
          <dt>推荐分类：</dt>
          <dd>
            <select name="categoryID" >
              <option value="0">请选择</option>
              <foreach name="categoryList" item="category">
              <option value="{$category.id}">{$category.name}</option>
              </foreach>
            </select>
          </dd>
        </dl>
        <dl>
          <dt>推荐描述：</dt>
          <dd>
            <input type="text" name="description" class="inp_default" >
          </dd>
        </dl>
  
        <div class="form_b" style="width: 300px; margin-left: 110px;">
          <input type="submit" class="button-green" id="submit" value="保 存">
          &nbsp;&nbsp;
          <input type="button" onClick="history.back()" class="button-return" value="返回">
        </div>
    </form>
  </div>
<script type="text/javascript">
  /**
   * [function_name description]
   * @param  {[type]} argument [description]
   * @return {[type]}          [description]
   */
  function productData(obj) 
  {
    var id = $(obj).val();
    $.ajax({
      url: '{:U(MODULE_NAME.'/Product/productData')}',
      type: 'post',
      dataType: 'json',
      data: {'id': id},
      success:function (data) 
      { 
        if(data.msg == 1)
        { 
          $('#productTitle').val(data.title);
        }
      }
    })
    
  }
</script>